//
//  UserData.swift
//  Jock
//
//  Created by HD on 15/4/6.
//  Copyright (c) 2015年 Haidy. All rights reserved.
//

import Foundation

class UserData {
    
    var articles: Articles!
    
    var uid: Int64!
    var hometown = ""
    var haunt = ""
    var qb_age = 0
    var icon_eday = 0
    var astrology = ""
    var mobile_brand = ""
    var smile_cnt = 0
    var big_cover = ""
    var big_cover_eday = 0
    var qs_cnt = 0
    var location = ""
    var hobby = ""
    var email = ""
    var login_eday = 0
    var wb = ""
    var relationship = ""
    var introduce = ""
    var job = ""
    var birthday: Int64!
    var icon = ""
    var qq = ""
    var gender = ""
    var created_at: Int64!
    var signature = ""
    var login = ""
    var age = 0
    
    ///保存数据
    func saveValue(config: BaseConfig) {
        articles.saveValue(config)
    }
    
    ///解析数据
    class func parser(json: JSON) -> UserData {
        var userData = UserData()
        userData.articles = Articles.parser(json["articles"])
        
        userData.uid = json["uid"].int64
        userData.hometown = json["hometown"].string!
        userData.haunt = json["haunt"].string!
        userData.qb_age = json["qb_age"].intValue
        userData.icon_eday = json["icon_eday"].intValue
        userData.astrology = json["astrology"].string!
        userData.mobile_brand = json["mobile_brand"].string!
        userData.smile_cnt = json["smile_cnt"].intValue
        userData.big_cover = json["big_cover"].string!
        userData.big_cover_eday = json["big_cover_eday"].intValue
        userData.qs_cnt = json["qs_cnt"].intValue
        userData.location = json["location"].string!
        userData.hobby = json["hobby"].string!
        userData.email = json["email"].string!
        userData.login_eday = json["login_eday"].intValue
        userData.wb = json["wb"].string!
        userData.relationship = json["relationship"].string!
        userData.introduce = json["introduce"].string!
        userData.job = json["job"].string!
        userData.birthday = json["birthday"].int64
        userData.icon = json["icon"].string!
        userData.qq = json["qq"].string!
        userData.gender = json["gender"].string!
        userData.created_at = json["created_at"].int64
        userData.signature = json["signature"].string!
        userData.login = json["login"].string!
        userData.age = json["age"].intValue
        return userData
    }

}